<?php

use DesignPatterns\Creator\AbstractFactory\MySQLFactory;

require 'autoload.php';

class Client
{
    public function run()
    {
        // 抽象工厂
        $factory = new MySQLFactory();

        // 工厂方法创建产品A实例
        $user = $factory->createUser();
        $user->insert();
        echo "\n";
        echo $user->select();

        echo "\n****************\n";
        // 工厂方法创建产品B实例
        $user = $factory->createArticle();
        $user->insert();
        echo "\n";
        echo $user->select();
    }
}

$client = new Client();
$client->run();